import java.util.Arrays;

class Student implements Comparable<Student>{
    public String name;
    public int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        return this.name.compareTo(o.name);
      //  return this.age-o.age;
    }
}
public class Test {
    public static void main(String[] args) {
        /*Student student1=new Student("zhangsan",10);
        Student student2=new Student("lisi",23);
        System.out.println(student1.compareTo(student2));*/
        Student[] students=new Student[3];
        students[0]=new Student("zansan",18);
        students[1]=new Student("lisi",20);
        students[2]=new Student("wangwu",28);
        Arrays.sort(students);
        System.out.println(Arrays.toString(students));
    }
}
